#
# This file is a part of the open-eBackup project.
# This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
# If a copy of the MPL was not distributed with this file, You can obtain one at
# http://mozilla.org/MPL/2.0/.
#
# Copyright (c) [2024] Huawei Technologies Co.,Ltd.
#
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
#

from informix.comm.const import JsonConstant
from informix.param.resource_base_param_parse import ResourceBaseParam


class ResourceParam(ResourceBaseParam):
    """
    资源接入入参文件的解析
    """

    def __init__(self, param_dict):
        super(ResourceParam, self).__init__(param_dict)

    @staticmethod
    def _get_target_value(is_match, json1, json2, key):
        return json1.get(key, "") if is_match else json2.get(key, "")

    def get_agent_ip_list_bound(self):
        return self.agent_ip_list_bound

    def get_host_uuid_curr(self):
        return self.appenv.get(JsonConstant.ID, "")

    def get_host_uuid_bound(self):
        return self.host_uuid_bound
